package com.chh.pdapp.activity.command;


import com.chh.pdapp.assembler.ActivityAssembler;
import com.chh.pdclient.dto.ActivityAddCmd;
import com.chh.pdclient.dto.data.ActivityVO;
import com.chh.pddomain.activity.ActivityEntity;
import com.chh.pddomain.gateway.ActivityGateway;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;


@Slf4j
@Component
@AllArgsConstructor
public class ActivityAddCmdExe {

    private final ActivityGateway activityGateway;

    public ActivityVO execute(ActivityAddCmd cmd) {
        ActivityEntity entity = activityGateway.save(ActivityAssembler.toAddEntity(cmd));

        return ActivityAssembler.toActivityVO(entity);
    }
}
